package com.bumblebee.server.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 * 
 * @author Dinesh
 *
 */
@Entity
public class User extends AbstractEntity{

	@Column(nullable = false)
	private String name;
	
	private Gender gender;
	
	@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
	@JoinColumn(name = "user_id")
	private Set<Address> addresses = new HashSet<Address>();
	
	@OneToOne
	private CommunicationDetails contactDetails;
	
	private String password;
	
	@Column(nullable = false)
	private String userId;
	
	@ManyToOne
	private UserRole userRole;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public CommunicationDetails getContactDetails() {
		return contactDetails;
	}

	public void setContactDetails(CommunicationDetails contactDetails) {
		this.contactDetails = contactDetails;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public UserRole getUserRole() {
		return userRole;
	}

	public void setUserRole(UserRole userRole) {
		this.userRole = userRole;
	}

	public Set<Address> getAddresses() {
		return addresses;
	}

	public void setAddresses(Set<Address> addresses) {
		this.addresses = addresses;
	}
	
}
